package com.huike.business.service.impl;


import com.huike.business.domain.TbBusiness;
import com.huike.business.domain.TbBusinessTrackRecord;
import com.huike.business.domain.vo.BusinessTrackVo;
import com.huike.business.mapper.TbBusinessTrackRecordMapper;
import com.huike.business.service.ITbBusinessTrackRecordService;
import com.huike.clues.domain.TbAssignRecord;
import com.huike.clues.utils.HuiKeCrmDateUtils;
import com.huike.common.constant.Constants;
import com.huike.common.utils.DateUtils;
import com.huike.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 商机跟进记录Service业务层处理
 * 
 * @author wgl
 * @date 2021-04-28
 */
@Service
public class TbBusinessTrackRecordServiceImpl implements ITbBusinessTrackRecordService {

    @Autowired
    private TbBusinessTrackRecordMapper tbBusinessTrackRecordMapper;

    /**
     * 新增商机跟进记录
     *
     * @param businessTrackVo
     */
    @Override
    public void insertTbBusinessTrackRecord(BusinessTrackVo businessTrackVo) {

        //封装对象
        TbBusinessTrackRecord tt = new TbBusinessTrackRecord();
        tt.setBusinessId(businessTrackVo.getBusinessId());
        tt.setCreateBy(SecurityUtils.getUsername());
        tt.setKeyItems(businessTrackVo.getKeyItems());
        tt.setRecord(businessTrackVo.getRecord());
        tt.setCreateTime(new Date());
        tt.setTrackStatus(businessTrackVo.getTrackStatus());
        tt.setNextTime(businessTrackVo.getNextTime());

        tbBusinessTrackRecordMapper.insertBusinessTrackRecord(tt);

    }

    /**
     * 查询商机跟进记录
     *
     * @param
     * @return
     */
    @Override
    public List<TbBusinessTrackRecord> selectTrackRecordById(Long id) {

        List<TbBusinessTrackRecord> tbBusinessTrackRecords = tbBusinessTrackRecordMapper.selectTrackRecordById(id);
        return tbBusinessTrackRecords;


    }
}